package com.shootforthestars.components;

public class LifeComponent {
	private int life;
	private int max;
	
	public LifeComponent(int max) {
		this.max = max;
		this.life = max;
	}
	
	public LifeComponent(int max, int life) {
		this.max = max;
		this.life = life;
	}
	
	public boolean isAlive() {
		return life > 0;
	}

	public void giveLife(int amount) {
		this.life += amount;
	}

	public void takeDamage(int amount) {
		this.life -= amount;
	}

	public float getLifePercentage() {
		return life / max;
	}

	public int getLife() {
		return life;
	}

	public void setLife(int life) {
		this.life = life;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}
}
